Skip to content

Conversation

@rical
Copy link
Contributor

@rical rical commented Dec 2, 2025

Description

Add service runtime statistics monitoring with memory usage, uptime, and restart counts. Includes a new SimpleTable framework for clean CLI formatting that handles ANSI colors correctly.

TODO

I realise now that I want to improve the SimpleTable() class to dynamically space columns based on added data. But I submit this as is because I don't want to risk leaving it dangling. Basically it works fine as it is but it can be improved (as always).

Checklist

Tick relevant boxes, this PR is-a or has-a:

  • Bugfix
    • Regression tests
    • ChangeLog updates (for next release)
  • Feature
    • YANG model change => revision updated?
    • Regression tests added?
    • ChangeLog updates (for next release)
    • Documentation added?
  • Test changes
    • Checked in changed Readme.adoc (make test-spec)
    • Added new test to group Readme.adoc and yaml file
  • Code style update (formatting, renaming)
  • Refactoring (please detail in commit messages)
  • Build related changes
  • Documentation content changes
    • ChangeLog updated (for major changes)
  • Other (please describe):

rical added 3 commits December 2, 2025 12:36
Add statistics container to service model with memory usage, uptime,
and restart count tracking.

Updates YANG revision to 2025-12-02.

Signed-off-by: Richard Alpe <[email protected]>
Populate operational runtime statistics for services.

Signed-off-by: Richard Alpe <[email protected]>
Replace manual f-string formatting with SimpleTable/Column classes.

This new "framework" handles ANSI colors and padding. Removing the
hassle of manually calculating padding. You simply specify the header
with max number of chars the data can be and if you want left/right
padding and the "framework" calculates the padding for you.

We use this new "framework" to pretty print the newly added services
statistics.

Signed-off-by: Richard Alpe <[email protected]>
@rical rical force-pushed the statd-add-service-stat branch from ae79d9b to 4f60230 Compare December 2, 2025 16:25
@rical rical force-pushed the statd-add-service-stat branch from 4f60230 to 9a26231 Compare December 2, 2025 16:43
Copy link
Contributor

@wkz wkz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great!

Don't these changes depend on the addition of memory stats to initctl -j though?

@rical
Copy link
Contributor Author

rical commented Dec 4, 2025

This looks great!

Thanks!

Don't these changes depend on the addition of memory stats to initctl -j though?

Yes and no. The code handles it gracefully if those stats aren't there yet, so it won't break anything. I wrote it this way intentionally so we could merge this without waiting for the finit upgrade that adds the memory counters. Basically wanted to keep this decoupled from the buildroot update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants